home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: New Zealand Amiga Users Group / New Zealand Amiga Users Group Newsdisk v03 (1987-02)(NZAmigaUG).zip / New Zealand Amiga Users Group Newsdisk v03 (1987-02)(NZAmigaUG).adf / BASIC / Triangles (.txt) < prev    next >
AmigaBASIC Source Code  |  1993-12-02  |  1KB  |  49 lines

  1.       REM  try 20 segments and click a square to get the idea!
  2.       REM 
  3.       ON BREAK GOSUB 5000
  4.       ON ERROR GOTO 5000
  5.       SCREEN 1,640,200,4,2
  6.       WINDOW 2,"Triangles",(0,0)-(600,180),7,1
  7.     1 col% = 2
  8.     5 DIM xx(500),yy(500)
  9.    10 INPUT"Divide segments by how many [0 to EXIT]";space
  10.    20 PRINT"Click your points. When done, click top left."
  11.       IF space=0 THEN 5000
  12.    40 GOSUB 1000
  13.    50 c%=0
  14.    60 xx(c%)=x%:yy(c%)=y%
  15.    65 CLS
  16.    70 PSET (x%,y%)
  17.    80 c%=c%+1
  18.    90 GOSUB 1000
  19.   100 IF (x%<10) AND (y%<10) THEN GOTO 200
  20.   110 xx(c%)=x%:yy(c%)=y%
  21.   120 LINE -( x%,y%)
  22.   125 FOR j%=0 TO 500:NEXT
  23.   130 IF c% < 499 GOTO 80
  24.   200 LINE -(xx(0),yy(0))
  25.   210 '                **********
  26.   220 FOR i% = 0 TO c%-1
  27.   230 xx(i%)=xx(i%) + ((xx(i%+1)-xx(i%))/space)
  28.   240 yy(i%)=yy(i%) + ((yy(i%+1)-yy(i%))/space)
  29.   245 xx(c%)=xx(0):yy(c%)=yy(0)
  30.   250 NEXT i%
  31.   260 xx(c%)=xx(0)
  32.   265 yy(c%)=yy(0)
  33.   270 PSET (xx(0),yy(0))
  34.   280 FOR i%=0 TO c%
  35.   290 LINE -(xx(i%),yy(i%))
  36.   300 NEXT i%:IF MOUSE(0)<0 THEN COLOR 1:CLS:GOTO 10
  37.   305 GOSUB 2000
  38.   310 GOTO 220
  39.  1000 b%= MOUSE(0):x%=MOUSE(1):y%=MOUSE(2)
  40.  1010 IF b% >= 0 THEN GOTO 1000
  41.  1020 RETURN
  42.  2000 col% = col% + 1
  43.  2010 col% = col% MOD 16
  44.  2020 COLOR col%,col%  
  45.  2030 RETURN
  46.  5000 SCREEN CLOSE 1
  47.  5010 STOP
  48.  
  49.